import React, { Component } from "react";
import Taro from '@tarojs/taro';
import { View,Image,Text } from '@tarojs/components';
import { AtButton,AtAvatar,AtIcon } from 'taro-ui'
import Tab from '../../components/tabBar/Tab';
import './mineshoucang.scss'
class Mineshoucang extends Component {
  constructor(props){
    super(props),
    this.state={
      listdetail:[]
    }
  }

  onReady () {
    console.log('onReady')
  }
  componentDidMount() {
    this.getListDetail();
  }
  getListDetail(){
    Taro.request({
      method:"POST",
      url: 'http://123.57.67.148:3000/mock/573/newproduct',
      data: {
        list: 'list',
        bar: 10
      },
      header: {
        'content-type': 'application/json'
      }
    })
      .then(res =>{
        this.setState({
          listdetail:res.data.newproduct
        })
        console.log(res.data)
      })
  }

  render () {
    return <View className='container'>
      <View>
      {this.state.listdetail.map((item, index) => {
          console.log(item)
              return (
                <View className='at-row hotcontent' key={index}>
                  <View className='at-col at-col-4'>
                  <Image className='middetimgs' style='width:120px;height:120px' src={item.imgurl}/>
                  </View>
                  <View className='at-col at-col-8'>
                    <View className='hotname'>
                      <Text style='font-size:16px'>{item.name}</Text>
                    </View>
                    <View className='quanbottom'>
                      <View className='hotright'>
              <View className='quanbottom1'>
              <Text style='font-size:16px'>2人成团</Text>
              <Text style='font-size:16px'>￥ {item.price}</Text>
              </View>
              <View>
              <AtButton  className='detbtn' size='small'>去开团</AtButton>
              </View>  
              </View>
                    </View>
              
                  </View>
                </View>
              )
            })}
        </View>   
        <Tab current={3}></Tab>
        </View>
  }
}

export default Mineshoucang